<template>
    <div class="inews">
        <div class="news_t">
            <span class="fr"><a href="#" @click.prevent="toIndexListView()">更多 ></a></span>新闻资讯
        </div>
        <ul>
            <li v-for="news in newsList" :key="news.id">
                <span>[ 公告 ]</span>
                <router-link :to="{ path: '/user', query: { tab: 'news', id: news.id } }">
                    {{ news.title }}
                </router-link>
            </li>
        </ul>
        <div class="charge_t">
            话费充值
            <div class="ch_t_icon"></div>
        </div>
        <form>
            <table style="width: 205px; margin-top: 10px" cellspacing="0" cellpadding="0">
                <tr height="35">
                    <td width="33">号码</td>
                    <td><input type="text" value="" class="c_ipt" /></td>
                </tr>
                <tr height="35">
                    <td>面值</td>
                    <td>
                        <select class="jj" name="city">
                            <option value="0" selected="selected">100元</option>
                            <option value="1">50元</option>
                            <option value="2">30元</option>
                            <option value="3">20元</option>
                            <option value="4">10元</option>
                        </select>
                        <span style="color: #ff4e00; font-size: 14px">￥99.5</span>
                    </td>
                </tr>
                <tr height="35">
                    <td colspan="2">
                        <input type="submit" value="立即充值" class="c_btn" />
                    </td>
                </tr>
            </table>
        </form>
    </div>
</template>

<script>
import { mapMutations } from 'vuex'
export default {
    name: 'InewsView',
    data() {
        return {
            newsList: [],
            title: '',
            createTime: '',
            pageNum: 1,
            pageSize: 5
        }
    },
    methods: {
        ...mapMutations(['setShowPage']),
        getNewsList() {
            this.$axios({
                url: '/selectNewsByPage',
                method: 'post',
                data: {
                    pageNum: this.pageNum,
                    pageSize: this.pageSize,
                    title: this.title,
                    createTime: this.createTime
                },
                headers: {
                    'Content-Type': 'application/json'
                }
            }).then(rs => {
                console.log(rs)
                this.newsList = rs.data.pageInfo.list
            })
        },

        toIndexListView() {
            this.$router.push({
                path: '/user',
                query: { tab: 'news' }
            }).catch(() => { });
        }
    },
    mounted() {
        this.getNewsList()
    }
}
</script>

<style></style>